<template>
  <fieldset>
    <legend>Cart</legend>
    <button @click="getProduct">点击获取购物车</button>
    <ul>
      <li v-for="it in shop" :key="it.id">{{ it.title }}</li>
    </ul>
  </fieldset>
</template>
<script>
// let baseUrl = process.env.VUE_APP_BASE_URL
import axios from "axios";
export default {
  data() {
    return {
      shop: [],
    };
  },
  methods: {
    getProduct() {
      axios
        .get("/api/data/index.json", {
          params: {
            name: "lilie",
          },
          headers: {
            qf: "aihsfnn",
          },
        })
        .then((res) => {
          console.log(res);
          this.shop = res.data;
        });
    },
  },
  mounted() {
    console.log(process.env);
  },
};
</script>
